package com.situ.mall.controller.front;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.situ.mall.common.ServerResponse;
import com.situ.mall.entity.Cart;
import com.situ.mall.entity.User;
import com.situ.mall.service.ICartService;


@Controller
@RequestMapping("/order")
public class FrontOrderController {
	@Autowired
	private ICartService cartService;

	@RequestMapping("/getOrderConfirmPage.shtml")
	public String getOrderConfirmPage(HttpSession session, Model model) {
		User user = (User) session.getAttribute("user");
		List<Cart> list = cartService.selectByUserId(user.getId());
		model.addAttribute("list", list);
		return "order_confirm";
	}
	
	@RequestMapping("/getUserCenterOrder")
	public String getUserCenterOrder(HttpSession session, Model model) {
		User user = (User) session.getAttribute("user");
		List<Cart> list = cartService.selectByUserId(user.getId());
		model.addAttribute("list", list);
		return "user_center_order";
	}
	
}
